import {componentsFnMap} from '../../config'
const settings = {
    "idPrefix":``,
    "labelName":"区间框组件",
    "componentNameShow":"区间框组件", // 负责显示组件的名称
    "busname":"ycRangeInput", // 唯一ID，不能重复,busname的值，关联着组件注册代码内部声明的全局校验方法，
    "componentName":'yc-range-input', // 依据在if1.3.js中使用Vue.component注册的具体名称决定,也用作vue中v-for的key值组成
    "minLength":"",
    "maxLength":"",
    "thousands":"",
    "minAmount":"",
    "maxAmount":"",
    "fixed":"",
}
/* 
<yc-range-input id="input_c_1730702364464" class="" name="" size="small" placeholder="不能为空"
    min-length="" max-length="" thousands="," min-amount="11" max-amount="1111" need-tooltip="0"
    fixed="2" :focusIndex="6" :value="c_1730702364464" @input="c_1730702364464 = $event">
</yc-range-input>
*/
componentsFnMap[settings.componentName] = {
    getHtmlStr (options = {}) {
       let {boxId, inputType="选填",componentValue = '',idPrefix = '',formName = '', formItemName = '',focusIndex = '',labelName = '标签名',labelWidth = '80px',placeholder = "不能为空"} = options
       let {minLength = '',maxLength = '',needTooltip = '0',colMd = '6',show = true,disabled,} = options
       let {thousands = '',minAmount = '',maxAmount = '',fixed = '',} = options
       let id = `${idPrefix}`
       const {busname,componentName} = settings
       let className = `formBox fieldBox YCInputWidget if-component if-form-group ycWidget col-md-${colMd}`
       return `
                    <div id="${boxId}"
                        class="${className} ${inputType === '禁用' ? 'disabled-fieldBox': ''}"
                        focusIndex="${focusIndex}" style="display:${show?'flex':'none'};">
                        <label class="text-right" style="width:${labelWidth}">
                            ${labelName}
                            <i class="${inputType === '必填'?'required':''}"></i>
                        </label>
                        <${componentName} id="${id}_${formItemName?formItemName:'inputName'}_${focusIndex}" class="" name="${formItemName}" size="small"
                            min-amount="${minAmount}" max-amount="${maxAmount}" fixed="${fixed}" thousands="${thousands}"
                            busname="${busname}" placeholder="${placeholder}" min-length="${minLength}" max-length="${maxLength}"
                            need-tooltip="${needTooltip}" :focusIndex="${focusIndex}" :value="${componentValue}" @input="${componentValue} = $event" ${inputType === '禁用' ? 'disabled': ''} ${inputType === '只读' ? 'readonly': ''}>
                        </${componentName}>
                    </div>    
       `
   }
}

export default settings